package com.emergency.db.dao.nuclear;

import com.emergency.db.domain.nuclear.Vessel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface VesselDao extends JpaRepository<Vessel, Long>, JpaSpecificationExecutor<Vessel> {
    @Modifying
    @Query(value = "delete FROM bas_nuclear_vessel WHERE inside_id = ? ", nativeQuery = true)
    void deleteByNuclear(Long id);

    @Query("select ve from Vessel ve where inside.id=:id ")
    Vessel findByNuclear(@Param("id") Long id);
}
